#ifndef MP_HTTP_SEND_COMPLETE_CALLBACK_H
#define MP_HTTP_SEND_COMPLETE_CALLBACK_H

#include <string>
#include <iostream>
#include "mpHttpResponseMessage.h"
#include "mpLocaleUtils.h"
#include "mpLog.h"
using namespace MP::HTTP;

class http_send_complete_callback
{
public:
    http_send_complete_callback(const std::string id)
        :_id(id)
    {
    }

    ~http_send_complete_callback(){
        MPLOG_INFO << "delete http_send_complete_callback." ;
    }

    void operator()(HttpResponseMessage::ptr_s httpResponseMessage){
        MPLOG_INFO << "thread [ " << std::this_thread::get_id() << " ] "
                  << "get " << _id << " complete, this is result :";

        MPLOG_INFO << "thread [ " << std::this_thread::get_id() << " ] "
                  << "SendStatuCode:" << HTTP_SEND_STATU_CODE_TOSTRING(httpResponseMessage->getSendStatuCode());

        MPLOG_INFO << "thread [ " << std::this_thread::get_id() << " ] "
                  << "Http Version:" << httpResponseMessage->getHttpVersion();

        MPLOG_INFO << "thread [ " << std::this_thread::get_id() << " ] "
                  << "Http Response Code:" << httpResponseMessage->getResponseCode();

        MPLOG_INFO << "thread [ " << std::this_thread::get_id() << " ] "
                  << "Http Reason Phrase:" << httpResponseMessage->getReasonPhrase();

        MPLOG_INFO << "thread [ " << std::this_thread::get_id() << " ] "
                  << "Http Response Content:" << SYS_TEXT(httpResponseMessage->getHttpResponseContent()->getData());
    }


private:
    std::string _id;

};

#endif // MP_HTTP_SEND_COMPLETE_CALLBACK_H
